package com.wzy.shirowebdemo.controller;

import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
@RequiresAuthentication
public class UserController {


    @RequestMapping("/noAuth")
    public String noAuth(){
        return "user/noAuth";
    }

    @RequiresPermissions("user/add")
    @RequestMapping("/add")
    public String toAdd(){
        return "user/add";
    }

    @RequiresPermissions("user/update")
    @RequestMapping("/update")
    public String update(){
        return "user/update";
    }

    @RequiresPermissions({"user/delete","user/list"})
    @RequestMapping("/delete/{id}")
    @ResponseBody
    public String delete(@PathVariable String id){
        return "delete";
    }
}
